package 力扣.比赛;

import java.util.HashMap;

public class 判断句子是否为全字母句1832 {
    //map
    public boolean checkIfPangram(String sentence) {
       if(sentence == null){
           return false;
       }
       if (sentence.length() == 0){
           return true;
       }
        HashMap<Character, Integer> hashMap = new HashMap<>(32);
        for (int i = 0; i < sentence.length(); i++) {
            char c = sentence.charAt(i);
            hashMap.put(c,1);
            if (hashMap.size() == 26){
                return true;
            }
        }
        return false;
    }
// 数组
    public boolean checkIfPangram2(String sentence) {
        if(sentence == null || sentence.length() < 26){
            return false;
        }
        int cnt = 0;
        int[] ins_cnt = new int[26];
        for (int i = 0; i < sentence.length(); i++) {
            char t = sentence.charAt(i);
            if (ins_cnt[t - 97] == 0){
                cnt++;
                ins_cnt[t- 97]++;
            }
        }
        return cnt == 26 ;
    }
}
